<template>
  <div>
    <h3>App</h3>
    <button @click="isShow=!isShow">显示/隐藏</button>
    <transition name="yu">
      <div class="box"
           v-show="isShow"></div>
    </transition>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      isShow: true,
    }
  },
}
</script>

<style>
.box {
  width: 300px;
  height: 50px;
  background-color: skyblue;
  transition: 1s linear;
}
.yu-enter,.yu-leave-to{
    transform: translateX(-300px);
}

.yu-enter-to, .yu-leave{
    transform: translateX(0px);
}


</style>